<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>修改用户|<{$configcache['Title']}></title>
<link rel="stylesheet" type="text/css" href="__CSS__/content.css"  />
<link rel="stylesheet" type="text/css" href="__CSS__/public.css"  />
<script type="text/javascript" src="__JS__/jquery.js"></script>
<script type="text/javascript" src="__JS__/Public.js"></script>
<script type="text/javascript" src="__JS__/winpop.js"></script>
<script type="text/javascript" src="__JS__/check.js"></script>
<script>
$(document).ready(function() {
	$('.button').click(function() {
        var id=$('input:hidden').val();
		var group_ids='';
        for (i=0; i<$('.group_ids').size(); i++) {
            if (!$('.group_ids').eq(i).attr('checked')==false) {
                group_ids=group_ids+$('.group_ids').eq(i).val()+',';
            }
        }
        var departmentid=$('.select').val();
        var username=$('#dl dd .qtext').eq(0).val();
        var password=$('#dl dd .qtext').eq(1).val();
        var email=$('#dl dd .qtext').eq(2).val();
        var description=$('#dl dd .textarea').val();
        var status=$('#dl dd input[name=status]:checked').val();
        
        if (!tcheck(id,'','用户ID获取失败')) { return false; }
        if (!tcheck(id,'number','用户ID获取失败')) { return false; }
        if (!tcheck(departmentid,'','用户部门ID获取失败')) { return false; }
        if (!tcheck(departmentid,'number','用户部门ID获取失败')) { return false; }
        if (!tcheck(username,'username','请输入正确的用户名')) { return false; }
        if (password!='') {
            if (password.length<6 || password.length>18) {
                wintq('请输入6~18位数的密码',2,2000,1,'');
                return;
            }
        }
        if (!tcheck(email,'email','请填写正确的邮箱地址')) { return false; }
        if (!tcheck(description,'0,30','描述请在30个字符以内','length')) { return false; }
		
		
		wintq('正在修改，请稍后...',4,2000,0,'');
		$.ajax({
			url:'__CONTROLLER__/useredit/',
			dataType:'json',
			type:'POST',
			data:{
                'id':id,
                'group_ids':group_ids,
                'departmentid':departmentid,
                'username':username,
                'password':password,
                'email':email,
                'description':description,
                'status':status
            },
			success: function(data) {
				if (data.s=='ok') {
					wintq('修改成功',1,1500,0,'__CONTROLLER__/useredit/id/'+id);
				}else {
					wintq(data.s,3,1000,1,'');
				}
			}
		});
	});
});
</script>
</head>
<body>
<div id="content">
	<dl id="dl">
    	<dt>修改用户信息</dt>
        <dd>
            <span class="dd_left">用户岗位：</span>
            <span class="dd_right" style="width: 400px;">
               
                <volist name='data' id='vo'>
                <span style="margin-right: 10px;"><input type="checkbox" class="group_ids" <in name="vo['id']" value="$group_data">checked="checked"</in> value="<{$vo.id}>"><{$vo.title}></span>
                </volist>
            </span>
        </dd>
        <dd>
            <span class="dd_left">所在部门：</span>
            <span class="dd_right">
                <select name="departmentid" class="select">
                    <volist name='department' id='vo'>
                    <option value="<{$vo.id}>" <if condition="$vo.id eq $user_data['departmentid']">selected</if>><{$vo.title}></option>
                    </volist>
                </select>
            </span>
        </dd>
        <dd>
        	<span class="dd_left">用户名：</span>
        	<span class="dd_right"><input type="text" class="qtext" maxlength="12" value="<{$user_data['username']}>" /><font>* 2～12位英文数字组合</font></span>
        </dd>
        <dd>
        	<span class="dd_left">密码：</span>
        	<span class="dd_right"><input type="password" class="qtext" maxlength="18" /><font>* 不填写则不修改</font></span>
        </dd>
        <dd>
        	<span class="dd_left">电子邮箱：</span>
        	<span class="dd_right"><input type="text" class="qtext" value="<{$user_data['email']}>" maxlength="30" /><font>* 如：admin@qq.com</font></span>
        </dd>
        <dd>
        	<span class="dd_left">用户说明：</span>
            <span class="dd_right"><textarea name="description" class="textarea"><{$user_data['description']}></textarea></span>
        </dd>
        <dd>
        	<span class="dd_left">状态：</span>
            <span class="dd_right"><label><input type="radio" name="status" class="status" value="0" <if condition="$user_data['status'] eq 0">checked</if> /> 正常</label><label><input type="radio" name="status" class="status" value="1" <if condition="$user_data['status'] eq 1">checked</if> /> 锁定</label><font>* 提示：如果没有修改任何信息，则会提示“数据修改失败”</font></span>
        </dd><input type="hidden" value="<{$user_data['id']}>" />
        <dd><input type="button" class="button" value="提 交" /></dd>
    </dl>
</div>
</body>
</html>
